<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns="http://www.w3.org/1999/xhtml" xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:st="http://www.whatisjee.com/ssf/tags" xmlns:rich="http://richfaces.org/rich" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:sf="http://www.whatisjee.com/ssf/functions" template="/common/template/#{param['cb'] eq null ? 'header-content' : 'popup'}.xhtml">
	<ui:param name="title" value="#{messages['user.title']}"/>
	<ui:define name="content">
		<s:validateAll>
			<h:panelGrid id="pgForm" columns="2" styleClass="form" columnClasses="label,input">
				<st:label for="itName" required="true" value="#{messages['user.name']}" />
				<s:decorate>
					<h:inputText id="itName" required="true" value="#{userAct.user.name}" styleClass="inputtext width50" maxlength="50" disabled="#{userAct.user.id ne null}" style="text-transform: uppercase" />
				</s:decorate>
				<st:label for="sbcPwdChged" value="#{messages['user.pwdChged']}" rendered="#{userAct.user.id ne null}" />
				<s:decorate rendered="#{userAct.user.id ne null}">
					<h:selectBooleanCheckbox id="sbcPwdChged" value="#{userAct.user.pwdChged}">
						<a4j:support action="#{userAct.togglePwdChanged}" ajaxSingle="true" event="onclick" reRender="pgForm" />
					</h:selectBooleanCheckbox>
				</s:decorate>
				<st:label for="isPassword" required="true" value="#{messages['user.password']}" />
				<s:decorate>
					<h:inputSecret id="isPassword" required="true" value="#{userAct.user.password}" styleClass="inputtext width25" maxlength="20" disabled="#{not userAct.user.pwdChged}" />
				</s:decorate>
				<st:label for="isPasswordEx" required="true" value="#{messages['user.passwordEx']}" />
				<s:decorate>
					<h:inputSecret id="isPasswordEx" required="true" value="#{userAct.password}" styleClass="inputtext widt25" maxlength="20" disabled="#{not userAct.user.pwdChged}" />
				</s:decorate>
				<st:label for="itFirstName" required="true" value="#{messages['user.firstName']}" />
				<s:decorate>
					<h:inputText id="itFirstName" required="true" value="#{userAct.user.firstName}" styleClass="inputtext width50" maxlength="50" />
				</s:decorate>
				<st:label for="itLastName" required="true" value="#{messages['user.lastName']}" />
				<s:decorate>
					<h:inputText id="itLastName" required="true" value="#{userAct.user.lastName}" styleClass="inputtext width50" maxlength="50" />
				</s:decorate>
				<st:label for="sbcEnabled" required="true" value="#{messages['user.enabled']}" />
				<s:decorate>
					<h:selectBooleanCheckbox id="sbcEnabled" value="#{userAct.user.enabled}" />
				</s:decorate>
				<st:label for="smcRoles" required="true" value="#{messages['user.roles']}" />
				<s:decorate>
					<h:selectManyCheckbox id="smcRoles" value="#{userAct.roleIds}">
						<s:selectItems var="_role" value="#{userAct.roles}" label="#{messages[_role.name]}" itemValue="#{_role.id}" />
					</h:selectManyCheckbox>
				</s:decorate>
				<rich:spacer />
				<h:panelGroup>
					<h:commandButton action="#{userAct.save}" value="#{messages['cmm.save']}" styleClass="button" />
					<input type="button" value="#{messages['cmm.cancel']}" class="button cancel" onclick="Ssf.cancel()" />
				</h:panelGroup>
			</h:panelGrid>
		</s:validateAll>
	</ui:define>
</ui:composition>
